// webpack.client.js
const path = require('path');
const nodeExternals = require('webpack-node-externals');

module.exports = {
    mode: 'development',
    // 在浏览器运行, 不需要node环境运行
    // target: 'node',
    entry: './src/client/index.js',
    output: {
        path: path.join(__dirname, 'public'),
        filename: "bundle.js"
    },
    // externals: [nodeExternals()],
    module: {
        rules: [
            {
                test: /\.js$/,
                exclude: /node_modules/,
                use: {
                    loader: "babel-loader",
                    options: {
                        presets: ["@babel/preset-env", "@babel/preset-react"]
                    }
                }
            }
        ]
    }
}